package com.basic.business.order.controller;


import java.util.List;
import java.io.IOException;

import com.basic.common.core.domain.AjaxResult;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.basic.common.core.controller.BaseController;
import com.basic.business.order.domain.TOrdersMain;
import com.basic.business.order.service.ITOrdersMainService;
import com.basic.common.core.page.TableDataInfo;

/**
 * 交易查询Controller
 * 
 * @author zhaoxy_jn@163.com
 */
@RestController
@RequestMapping("/business/ordersMain")
public class TOrdersMainController extends BaseController
{
    @Resource
    private ITOrdersMainService tOrdersMainService;

    /**
     * 查询交易查询列表
     */
    @PreAuthorize("@ss.hasPermi('business:ordersMain:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody TOrdersMain tOrdersMain)
    {
        startPage();
        List<TOrdersMain> list = tOrdersMainService.getList(tOrdersMain);
        return getDataTable(list);
    }

    /**
     * 获取未分配订单
     */
    @PreAuthorize("@ss.hasPermi('business:ordersMain:undistributed')")
    @GetMapping("/getUndistributedOrder")
    public TableDataInfo getUndistributedOrder(TOrdersMain tOrdersMain) throws IOException
    {
        startPage();
        List<TOrdersMain> list = tOrdersMainService.getUndistributedOrder(tOrdersMain);
        return getDataTable(list);
    }

    /**
     * 我的订单
     */
    @PreAuthorize("@ss.hasPermi('business:ordersMain:myTask')")
    @GetMapping("/getMyTasks")
    public TableDataInfo getMyTasks(TOrdersMain tOrdersMain)
    {
        startPage();
        List<TOrdersMain> list = tOrdersMainService.getMyTasks(tOrdersMain);
        return getDataTable(list);
    }

    /**
     * 我的订单模块超时订单个数
     */
    @GetMapping("/getOverdue48Count")
    public AjaxResult getOverdue48Count(TOrdersMain tOrdersMain)
    {
        return success(tOrdersMainService.getOverdueCount(tOrdersMain));
    }

    /**
     * 订单查询模块超时24订单个数
     */
    @GetMapping("/getOverdue24Count")
    public AjaxResult getOverdue24Count(TOrdersMain tOrdersMain)
    {
        return success(tOrdersMainService.getOverdue24Count(tOrdersMain));
    }

}
